import Vue from "vue";
import VueRouter from "vue-router";
import home from "./modules/home.js";
import goods from "./modules/goods.js";
import goodsInfo from "./modules/goodsInfo.js";
import about from "./modules/about.js";
import cart from "./modules/cart.js";

Vue.use(VueRouter);
const routes = [...home, ...goods, ...about, ...goodsInfo, ...cart];

const router = new VueRouter({
  routes,
  scrollBehavior(to, from, savedPosition) {
    return { x: 0, y: 0 };
  },
});

router.beforeEach((to, from, next) => {
  next();
});

export default router;
